package com.insurance.modules.claim.controller;

import com.insurance.common.utils.R;
import com.insurance.modules.claim.entity.SettlementCancelEntity;
import com.insurance.modules.claim.service.SettlementCancelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 撤销信息表
 *
 * @author weiruifeng
 * @email
 * @date 2021-09-24 17:42:47
 */
@RestController
@RequestMapping("claim/settlementcancel")
@Api(tags = "撤销信息")
public class SettlementCancelController {
    @Autowired
    private SettlementCancelService settlementCancelService;

    /**
     * 保存撤销信息
     */
    @PostMapping("/save")
    @RequiresPermissions("claim::settlementcancel:save")
    @ApiOperation(value = "保存撤销信息", notes = "保存撤销信息")
    public R save(@RequestBody SettlementCancelEntity settlementCancel) {
        settlementCancelService.saveAndChangeStatus(settlementCancel);
        return R.ok();
    }

    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("claim::settlementcancel:info")
    @ApiOperation(value = "根据id查询撤销信息", notes = "根据id查询撤销信息")
    public R info(@PathVariable("id") String id) {
        SettlementCancelEntity settlementCancel = settlementCancelService.getById(id);
        return R.ok().put("settlementCancel", settlementCancel);
    }

}
